package cn.itsource.pethome.system.role.mapper;

import cn.itsource.pethome.system.menu.domain.Menu;
import cn.itsource.pethome.system.permission.domain.Permission;
import cn.itsource.pethome.system.role.domain.Role;
import cn.itsource.pethome.base.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author itsource
 * @since 2023-02-01
 */
public interface RoleMapper extends BaseMapper<Role> {

    //给中间表添加数据
    void addMenus(List<Map<String,Long>> roleMenus);

    void addPermissions(List<Map<String,Long>> rolePermissions);

    //删除中间表的数据
    void delMenuByRoleId(Long id);

    void delPermissionByRoleId(Long id);

    //通过角色id查询对应的菜单和权限
    List<Menu> getMenuByRoleId(Long id);

    List<Permission> getPermissionByRoleId(Long id);

    /**
     * 根据角色id查询权限sn
     * @param roleId
     * @return
     */
    List<String> findPermissions(Long roleId);
}
